﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using GameBase;
using System.Threading;

namespace GalaxyPresident
{
    class LoadingScreen:GameScreen
    {
        GAME_INFO _gameInfo;
        PlayingScreen playingScreen;
        public LoadingScreen(Game1 game, GAME_INFO gameInfo)
            : base(game)
        {
            _gameInfo = gameInfo;
            //VisibleObject 
            AddChild(new VisibleObject(@"Resources/loading",4,2,
                new Microsoft.Xna.Framework.Vector2(50,Constant.screenHeight-150)));
            ThreadStart threadStarter = delegate
            {
                // Do Work Here
                //Thread.Sleep(300);
                playingScreen = new PlayingScreen(game, _gameInfo);
                Game.State = playingScreen;
                Thread.Sleep(300);
            };
            Thread loadingThread = new Thread(threadStarter);
            loadingThread.Start();
        }
        
        bool drawed = false;
        public override void Update(Microsoft.Xna.Framework.GameTime gameTime)
        {
            base.Update(gameTime);
            if (drawed)
            {
                if (playingScreen == null)
                {
                    
                }
                else
                {
                    
                }
            }
        }
        public override void Draw(Microsoft.Xna.Framework.GameTime gameTime, Microsoft.Xna.Framework.Graphics.SpriteBatch spriteBatch)
        {
            base.Draw(gameTime, spriteBatch);
            drawed = true;
        }
    }
}
